package com.dong.webtest;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.executable.ValidateOnExecution;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dengxiudong
 * @Date 2024/9/24 上午11:34
 */
@Slf4j
@RestController
public class ValidController
{

    @GetMapping("/hello")
    public String hello(@NotBlank String aa, @NotNull Integer bb, @Valid User user)
    {
        log.info("hello: {}, {}, {}", aa, bb, user);
        return "hello";
    }

    @PostMapping("/add")
    public User add(@NotNull User user)
    {
        log.info("add user: {}", user);
        return user;
    }
}
